#! /usr/bin/env bash
#
# template.tseries_generate used to create the $CASEROOT/$CASE.timeseries
#
# TODO - need to get the PE count from the config_pes.xml tag
# for the specified machine
# <timeseries_pes>##</timeseries_pes>
#

{_batchdirectives_}

mpirun={_mpirun_}

# xmlquery to get POSTPROCESS_VIRTUALENV, BATCHSUBMIT variable settings
virtualEnvDir=`./xmlquery POSTPROCESS_VIRTUALENV -value`
caseRoot=`./xmlquery CASEROOT -value`

cd $virtualEnvDir/bin
activate virtualenv

$mpirun ./cesm_tseries_generator.py --caseroot $caseRoot >> $caseRoot/tSeriesStatus 2>&1

deactivate

